package com.castle.fortress.admin.study.course.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.castle.fortress.admin.member.dto.MemberDto;
import com.castle.fortress.admin.study.course.dto.StudyCourseDto;
import com.castle.fortress.admin.study.course.entity.StudyCourseEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
/**
 * 课程管理Mapper 接口
 *
 * @author castle
 * @since 2023-01-30
 */
public interface StudyCourseMapper extends BaseMapper<StudyCourseEntity> {

	/**
	 * 扩展信息列表
	 * @param pageMap
	 * @param studyCourseEntity
	 * @return
	 */
	List<StudyCourseEntity> extendsList(@Param("map")Map<String, Long> pageMap, @Param("studyCourseEntity") StudyCourseEntity studyCourseEntity);

	/**
	 * 扩展信息记录总数
	 * @param studyCourseEntity
	 * @return
	 */
	Long extendsCount(@Param("studyCourseEntity") StudyCourseEntity studyCourseEntity);

	/**
	 * 课程管理扩展详情
	 * @param id 课程管理id
	 * @return
	 */
      StudyCourseEntity getByIdExtends(@Param("id")Long id);

	/**
	 * 修改置顶状态
	 * @param id
	 * @param val
	 */
    void updateRecommend(@Param("id")Long id, @Param("val")Integer val);

	/**
	 * 修改课程状态
	 * @param id
	 * @param val
	 */
	void updateCoursestatus(@Param("id")Long id, @Param("val")Integer val);

	/**
	 * 会员学习的课程及进度
	 * @param studyCourseDto
	 * @param member
	 * @return
	 */
    List<StudyCourseEntity> scheduleList(@Param("studyCourseDto")StudyCourseDto studyCourseDto, @Param("member")MemberDto member);
    List<StudyCourseEntity> finishList(@Param("studyCourseDto")StudyCourseDto studyCourseDto, @Param("member")MemberDto member);

	void updateRecommendType(@Param("id")Long id, @Param("val")String val);

	/**
	 * 会员学习的课程详情
	 * @param id
	 * @return
	 */
	StudyCourseEntity studyInfo(@Param("id")Long id,@Param("memberId")Long memberId);

	/**
	 * 会员课程收藏列表
	 * @param memberId
	 * @return
	 */
	List<StudyCourseEntity> collectList(@Param("memberId")Long memberId);

    void delByClassifyId(@Param("id")Long id);

	List<StudyCourseEntity> memberStudyList(@Param("map")Map<String, Long> pageMap, @Param("studyCourseEntity") StudyCourseEntity studyCourseEntity);

	Long memberStudyCount(@Param("studyCourseEntity") StudyCourseEntity studyCourseEntity);

    void updateAllStatus(@Param("courseId")Long courseId, @Param("courseStatus")Integer courseStatus, @Param("isRecommend")Integer isRecommend);
}

